import App from './App'
import share from '@/libs/share.js'
Vue.mixin(share);
// #ifndef VUE3
import Vue from 'vue';
import './uni.promisify.adaptor';
import myRequest from "./libs/request.js";
Vue.prototype.$api = myRequest;
import common from './libs/common.js';
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif

//跳转
Vue.prototype.$to = function(url) {
	if (url.indexOf('tab') > -1) {
		uni.switchTab({
			url
		})
	} else {
		uni.navigateTo({
			url
		});
	}
}
// 返回
Vue.prototype.back = function(delta = 1) {
	uni.navigateBack({
		delta: delta,
		fail() {
			uni.switchTab({
				url: '/pages/tab/index'
			})
		}
	});
}
//提示框
Vue.prototype.showToast = function(msg = '') {
	uni.showToast({
		title: msg,
		icon: 'none'
	});
}